package com.paul.sys.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;


import sun.misc.BASE64Encoder;
public class TrafficMd5 {
   public static String md5(String pwd){
	    if(pwd == null || "".equals(pwd)){
	           pwd = "8888";
	    }
		String b64 = "z3muat26YK0Bg0c1m9FE0g==";
		byte [] bytPwd = pwd.getBytes();
		MessageDigest alg;
		try {
			alg = MessageDigest.getInstance("MD5");
			alg.update(bytPwd);
		    byte[] digest = alg.digest();
		    BASE64Encoder encoder = new BASE64Encoder();
		 
		    b64 =encoder.encode(digest);
		} catch (NoSuchAlgorithmException e1) {
			e1.printStackTrace();
		} catch (Exception e2){
			e2.printStackTrace();
		}
		
		return b64;
   }
   
   
   public static void main(String[] args) {
				
		System.out.println(md5("8888"));
	}
}
